import Vue from "vue"
import Router from "vue-router"
import Main from "../views/Main"
import Login from "../views/Login"
import LoginTest from "../views/LoginTest"

import UserList from "../views/user/List"
import UserProfile from "../views/user/Profile"
import NotFound from "../views/NotFound"

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes:[
    {
      path : "/main/:name",
      component:Main,
      props:true,
      //嵌套路由
      children : [
        { // 嵌套路由
          path: '/user/profile/:id/:name',
          name:'UserProfile',
          component: UserProfile,
          props:true

        }, {
          path: '/user/list',
          component: UserList
        }
      ]
    },{
      path : "/login",
      component:Login
    },{
      path : "/loginTest",
      component : LoginTest
    },{
      path: '/goHome/:name',
      name : 'goHome',
      redirect:'/main/:name'
    },{
      path :'*',
      component :NotFound,
    }


  ]

})
